package project.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import project.DAO.TouchDAO;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@Controller
public class TDController {
    @Autowired
    TouchDAO TouchDao;
    @RequestMapping("/TD")
    public String TD()
    {
        return "TD";
    }
    @RequestMapping("touch")
    public String touch(HttpServletRequest request)
    {
        String sno=request.getParameter("sno");
        String name=request.getParameter("name");
        String  time=request.getParameter("time");
     TouchDao.insertTouch(sno,name,time);
     return "forward:/TD";
    }
    @RequestMapping("touch1")
    public String touch1(HttpServletRequest request)
    {
        String sno=request.getParameter("sno");
        TouchDao.deleteSno(sno);
        return "forward:/TD";
    }
    @RequestMapping("touch2")
    public String touch2(HttpServletRequest request)
    {
        String name=request.getParameter("name");
        TouchDao.deleteName(name);
        return "forward:/TD";
    }
}
